import { userAccountLogin } from '@/api/user'
export default {
  namespaced: true,
  state () {
    return {
      profile: {}
    }
  },
  mutations: {
    // 保存用户信息
    setProfile (state, playload) {
      state.profile = playload
    },
    // 删除用户信息
    removeProfile (state) {
      state.profile = {}
    }
  },
  actions: {
    // 发送请求获取用户信息
    async asyncSetUser (ctx, playload) {
      const res = await userAccountLogin(playload)
      console.log(res)
      ctx.commit('setProfile', res.result)
    }
  }
}
